Repository navigation
Owner-only discard of construction evidence - #138
Closed
leonardoaraujosantos wants to merge 8 commits into
Closed
leonardoaraujosantos wants to merge 8 commits into
leonardoaraujosantos wants to merge 8 commits into
Conversation
Observe a stage through a no-follow, non-blocking handle (regular single-link file, 1 MiB bound, SHA-256), move it with a no-replace rename into a private discarded/<key>/ slot of its namespace and unlink it there only while its identity still matches. Checkout claim and acknowledgement stages are fenced by their constructor lock and published records; file-copy cancellation-record stages are bound to their exact origin, the namespace lock and the owner's lifetime lock, and quarantined bytes keep counting toward the snapshot cap.
Review is read-only and fingerprints the stage and Session revision; confirm re-fences the Session and owner activity, records a durable session.snapshot.construction_discarded.1 intent, quarantines and unlinks the stage and completes the receipt. A repeated request ID resumes the frozen plan, lookup never acts and maintenance retries pending unlinks hourly. Review and confirm refuse bearer, peer, browser and MCP callers with 403.
cyber sessions recovery-discard lists, reviews and confirms one stage; recovery-discard-request looks a receipt up. sessions recovery, the TUI recovery panels and cyber doctor show construction evidence and discard pending requests with the exact command; the TUI has no discard action.
A SIGKILLed claim stage refuses discard while its preparation is unresolved and for a stale review, then is discarded and worktree removal is admitted. A cut table kills the service after the intent, after the quarantine move and after the unlink; each request resumes, maintenance finishes a moved stage and doctor reports it as pending meanwhile.
…ade fixture The two path helpers are only used by the Unix implementation and broke the Windows -D warnings build. The doctor JSON test now expects the new construction discards check. The upgrade test archive is compressed at the fastest level, since a stored debug binary on Linux CI now exceeds the upgrader's 512 MiB download cap.
On Linux CI the debug binary with line tables is larger than the upgrader's per-member archive limit, so compression alone did not keep the fixture valid. A stripped copy still runs, which the test needs to check that the next start removes cyber.old.
Contributor
Author
|
Merged into main via #140 (contains every commit of this PR). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Advances #93. Stacked on #123 (
feat/managed-recovery-owner). Retarget tomainonce #123 merges.Summary
This implements the approved OpenSpec change
add-construction-evidence-discard(tasks 2.1–2.4). The local owner can now discard one unpublished construction stage at a time, in two steps (review, then confirm), and each discard leaves an audit receipt. A stage is one of:preparing_*)ack_preparing_*)tmp_*besidepreparation.json)Before this, nothing could remove these stages, so a managed worktree with one could never be removed.
cyber_core::construction_discard):discarded/<key>/slot in the same namespace. Every step re-checks the identity; a file that differs is reported and never deleted.Repository::{review,fence}_snapshot_construction. Cancellation-record fences are incyber-snapshotcopy::discard.GET /sessions/{id}/rewind/constructionslists stages anddiscard pendingrequests.POST .../discard/review,POST .../discard/confirm,GET .../discard/requests/{request_id}.session.snapshot.construction_discarded.1events in the Session's history (intent, then completed / pending / changed).constructionInventory,constructionDiscardReview/Confirm/Lookup).cyber sessions recovery-discardandrecovery-discard-request.sessions recovery, both TUI recovery panels andcyber doctorshow the evidence and pending discards with the exact command. The TUI has no discard action (owner decision).docs/cli.mdanddocs/rewind.mdare updated.Design decisions
These are recorded in design.md under "Implementation notes".
403 owner_onlyfor a bearer token,X-Cyber-Attach, a browser (Origin/Sec-Fetch-Mode) or anmcp:client label.<op>.lockexists..snapshot-ackfrom another stage exists.preparation.jsonexists.tmp_*file counts only when its complete bytes are the cancellation receipt of the exact origin that owns the journal. Any other journal file is never touched.Tests
cyber-cli/tests/support/construction_discard.rs, real binary,native-git-acceptance(new CI step innon-git-snapshot-proof.yml):construction-discard-intent-committed,-quarantinedand-unlinked. For each cut: the intent is durable; the listing anddoctorshowdiscard pending; maintenance finishes a moved stage on its own; the same request ID resumes to completed; removal is admitted.cyber-server/tests/http.rs: 403 for every non-owner caller on review and confirm; listing is read-only; lookup returns 404.cyber-coretests:cyber-snapshottests:branches_clipreparation_/managed_git_/checkout_claimtests pass.fmt --check,clippy --all-targets -D warnings(cognitive complexity ≤ 15 enforced by clippy.toml),openspec validate --all --strict,spec_lint(0 errors),spec_inventory --check,help-markdownequalsdocs/cli.md.Not covered / open for the owner
discard pendingbut do not count toward the snapshot cap.